#include <stdio.h>
#include <time.h>
#include <ctime>
#include <stdlib.h>


void bubble(int* v, int sz){

	bool switched = false;
	int tmp;
	for(int i=0; i < sz; i++){
		if(i == (sz-1)) break;
		if(v[i] < v[i+1]){
			tmp = v[i];
			v[i] = v[i+1];
			v[i+1] = tmp;
			switched = true;
		}
	}

	if(switched == true){
		bubble(v, sz);
	}
}

int main(){

	srand((unsigned)time(0)); 
	int v[20];
	for(int i =0; i < 20; i++){
		v[i] = rand() % 100;
		printf("%d ", v[i]);
	}
	printf("\n");

	bubble(v, 20);

	for(int i =0; i < 20; i++){
		printf("%d ", v[i]);
	}
	printf("\n");

	return 0;
}
